import request from '@/utils/request'


///////商家记录表

export function getRetailers(params) {
  return request({
    url: '/member/retailer/',
    method: 'GET',
    params
  })
}

export function getAllRetailer() {
  return request({
    url: '/member/retailer_list/',
    method: 'GET',

  })
}

export function addRetailer(data) {
  return request({
    url: '/member/retailer/',
    method: 'POST',
    data
  })
}

export function updateRetailer(data) {
  return request({
    url: `/member/retailer/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delRetailer(id) {
  return request({
    url: `/member/retailer/${id}/`,
    method: 'DELETE',
  })
}

export function delRetailers(data) {
  return request({
    url: '/member/retailer/batch_delete',
    method: 'DELETE',
    data
  })
}

export function delRetailerImage(id) {
  return request({
    url: `/member/retailer_image/${id}/`,
    method: 'DELETE',
  })
}

///////商家赠送积分

export function getBonusPoints(params) {
  return request({
    url: '/member/bonus_point/',
    method: 'GET',
    params
  })
}

export function addBonusPoint(data) {
  return request({
    url: '/member/bonus_point/',
    method: 'POST',
    data
  })
}

export function updateBonusPoint(data) {
  return request({
    url: `/member/bonus_point/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delBonusPoint(id) {
  return request({
    url: `/member/bonus_point/${id}/`,
    method: 'DELETE',
  })
}

export function delBonusPoints(data) {
  return request({
    url: '/member/bonus_point/batch_delete/',
    method: 'DELETE',
    data
  })
}

///////客户积分消费

export function getPointConsumptions(params) {
  return request({
    url: '/member/point_consumption/',
    method: 'GET',
    params
  })
}

export function addPointConsumption(data) {
  return request({
    url: '/member/point_consumption/',
    method: 'POST',
    data
  })
}

export function updatePointConsumption(data) {
  return request({
    url: `/member/point_consumption/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delPointConsumption(id) {
  return request({
    url: `/member/point_consumption/${id}/`,
    method: 'DELETE',
  })
}

export function delPointConsumptions(data) {
  return request({
    url: '/member/point_consumption/batch_delete/',
    method: 'DELETE',
    data
  })
}


///////商家授权员工

export function getEmployees(params) {
  return request({
    url: '/member/employee/',
    method: 'GET',
    params
  })
}

export function addEmployee(data) {
  return request({
    url: '/member/employee/',
    method: 'POST',
    data
  })
}

export function updateEmployee(data) {
  return request({
    url: `/member/employee/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delEmployee(id) {
  return request({
    url: `/member/employee/${id}/`,
    method: 'DELETE',
  })
}

export function delEmployees(data) {
  return request({
    url: '/member/employee/batch_delete/',
    method: 'DELETE',
    data
  })
}

// 商家权限
export function getPermissions(params) {
  return request({
    url: '/member/retailer_permission/',
    method: 'GET',
    params
  })
}

export function getAllPerms() {
  return request({
    url: '/member/retailer_perms_list/',
    method: 'GET',
  })
}

export function addPermission(data) {
  return request({
    url: '/member/retailer_permission/',
    method: 'POST',
    data
  })
}

export function updatePermission(data) {
  return request({
    url: `/member/retailer_permission/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delPermission(id) {
  return request({
    url: `/member/retailer_permission/${id}/`,
    method: 'DELETE',
  })
}

export function delPermissions(data) {
  return request({
    url: '/member/retailer_permission/batch_delete/',
    method: 'DELETE',
    data
  })
}

// 商家角色
export function getRoles(params) {
  return request({
    url: '/member/retailer_role/',
    method: 'GET',
    params
  })
}

export function getAllRoles(params) {
  return request({
    url: '/member/retailer_role_list/',
    method: 'GET',
    params
  })
}

export function addRole(data) {
  return request({
    url: '/member/retailer_role/',
    method: 'POST',
    data
  })
}

export function updateRole(data) {
  return request({
    url: `/member/retailer_role/${data.id}/`,
    method: 'PUT',
    data
  })
}

export function delRole(id) {
  return request({
    url: `/member/retailer_role/${id}/`,
    method: 'DELETE',
  })
}

export function delRoles(data) {
  return request({
    url: '/member/retailer_role/batch_delete/',
    method: 'DELETE',
    data
  })
}